home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 038a / qbsbkit.zip / CTVOUT.BAS < prev    next >
BASIC Source File  |  1991-05-05  |  2KB  |  83 lines

  1.  
  2. 'QBXSBC CTVOUT.BAS
  3. 'voice output example for the SoundBlaster routines
  4. '5-May-1991
  5.  
  6. DEFINT A-Z
  7.  
  8. REM $INCLUDE: 'QBXIOL.BI'
  9. REM $INCLUDE: 'QBXCTV.BI'
  10. REM $INCLUDE: 'QBXFMI.BI'
  11.  
  12. CLS
  13. PRINT "CTVOUT.BAS for QBXSBC"
  14. PRINT
  15. PRINT "CTVport   stat:"; CTVport(&H220)
  16. PRINT "CTVirq    stat:"; CTVirq(&H7)
  17. stat = CTVdetect
  18. PRINT "CTVdetect stat:"; stat
  19. PRINT "CTVver    stat:"; CTVver(soft, hard);
  20. PRINT "  S/W:"; RTRIM$(STR$(soft \ 256)); "."; LTRIM$(STR$(soft MOD 256));
  21. PRINT "  H/W:"; RTRIM$(STR$(hard \ 256)); "."; LTRIM$(STR$(hard MOD 256))
  22. IF stat THEN
  23.    SELECT CASE stat
  24.    CASE 1
  25.       PRINT "SBC failed or is not installed"
  26.    CASE 2
  27.       PRINT "SBC I/O R/W failed"
  28.    CASE 3
  29.       PRINT "SBC DMA failed"
  30.    CASE ELSE
  31.       PRINT "Unexpected failure code"
  32.    END SELECT
  33.    SYSTEM
  34. END IF
  35.  
  36. pathname$ = "WATSON.VOC"
  37. PRINT
  38. PRINT "playing voice file: "; pathname$
  39.  
  40. 'open the voice file and get its length
  41. stat = OpenDevice(pathname$ + CHR$(0), 2, handle, flen&)
  42. IF stat THEN PRINT "Open:"; stat: STOP
  43.  
  44. 'Get the voice data
  45. 'allocate a buffer large enough for the voice data
  46. REDIM VocBuff(0 TO flen&) AS INTEGER
  47. vseg = VARSEG(VocBuff(0))
  48. voff = VARPTR(VocBuff(0))
  49.  
  50. stat = ReadDevice(handle, 0, flen&, vseg, voff)
  51. IF stat THEN PRINT "Read:"; stat: STOP
  52. stat = CloseDevice(handle)
  53. IF stat THEN PRINT "Close:"; stat: STOP
  54.  
  55. 'turn voice speaker on
  56. stat = CTVspeaker(1)
  57.  
  58. 'and play it (that simple)
  59. stat = CTVoutput(vseg, voff + 26)
  60.  
  61. IF stat = 0 THEN
  62.  
  63.    PRINT
  64.    PRINT "Will pause in 1 second. ";
  65.    SLEEP 1
  66.    stat = CTVpause
  67.  
  68.    PRINT "Press a key to continue output."
  69.    SLEEP
  70.    a$ = INKEY$
  71.    stat = CTVcontinue
  72.  
  73.    'wait until it's done speaking (or do something else)
  74.    DO
  75.       stat = CTVstatus
  76.    LOOP WHILE stat
  77.  
  78. END IF
  79.  
  80. stat = CTVuninstall
  81. PRINT "done."
  82.  
  83.